﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;


namespace ddb_BT1
{
    public partial class frmReport_HoaDonBH : DevExpress.XtraEditors.XtraForm
    {
        public frmReport_HoaDonBH() 
        {
            InitializeComponent();
        }
        public frmReport_HoaDonBH(DataTable table,string tenkhachhang,string diachi,string sodt,string masothue,DateTime ngayhoadon,string tongtienchu)
        {
            InitializeComponent();/*
            printControl1.PrintingSystem = rpt.PrintingSystem;
            rpt.CreateDocument();*/
            rptHDBanHang report = new rptHDBanHang();
            report.DataSource = table;
            report.DataMember = "Table";
            report.Parameters["tenkhachhang"].Value = tenkhachhang;
            report.Parameters["diachi"].Value = diachi;
            report.Parameters["sodt"].Value = sodt;
            report.Parameters["masothue"].Value = masothue;
            report.Parameters["ngayhoadon"].Value = ngayhoadon;
            report.Parameters["thanhtienchu"].Value =tongtienchu.ToUpper();


            printControl1.PrintingSystem = report.PrintingSystem;

            report.CreateDocument();

        }
        public frmReport_HoaDonBH(DataTable table, string tenkhachhang, string diachi, string sodt, string masothue, DateTime ngayhoadon, string tongtienchu,string phanbiet)
        {
            InitializeComponent();/*
            printControl1.PrintingSystem = rpt.PrintingSystem;
            rpt.CreateDocument();*/
            rptPhieuXuatKho report = new rptPhieuXuatKho();
            report.DataSource = table;
            report.DataMember = "Table";
            report.Parameters["tenkhachhang"].Value = tenkhachhang;
            report.Parameters["diachi"].Value = diachi;
            report.Parameters["sodt"].Value = sodt;
            report.Parameters["masothue"].Value = masothue;
            string t="";
            DataTable dt=DataProvider.getDataTable(string.Format("select distinct TKKHO from CHITIET_HOADON_BH where STT_HOADON_BH='{0}'",phanbiet));
            for(int i=0;i<dt.Rows.Count;i++)
            {
                t=t+" "+dt.Rows[i][0];
            }
            string tt = "";
            DataTable dtt = DataProvider.getDataTable(string.Format("select distinct TKVON from CHITIET_HOADON_BH where STT_HOADON_BH='{0}'", phanbiet));
            for (int i = 0; i < dtt.Rows.Count; i++)
            {
                tt = tt + " " + dtt.Rows[i][0];
            }
            report.Parameters["TKCO"].Value = t;
            report.Parameters["TKNO"].Value = tt;
            report.Parameters["thanhtienchu"].Value = tongtienchu.ToUpper();


            printControl1.PrintingSystem = report.PrintingSystem;

            report.CreateDocument();

        }
        public frmReport_HoaDonBH(DataTable table, string TITLE)
        {
            InitializeComponent();/*
            printControl1.PrintingSystem = rpt.PrintingSystem;
            rpt.CreateDocument();*/
            rptTheoDoiHoaDonBH rpt = new rptTheoDoiHoaDonBH();
            rpt.DataSource = table;
            rpt.DataMember = "table";
            rpt.Parameters["tieude"].Value = TITLE;
            printControl1.PrintingSystem = rpt.PrintingSystem;

            rpt.CreateDocument();

        }
        private void frmReport_HoaDonBH_Load(object sender, EventArgs e)
        {

        }
    }
}